﻿<Application x:Class="Ingenious.Core.TestHarness.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:graph="clr-namespace:Ingenious.Graph;assembly=Ingenious.Core"
             xmlns:local="clr-namespace:Ingenious.Core.TestHarness"             
             StartupUri="MainWindow.xaml">
    
    <Application.Resources>

        <!-- A dynamic property whose value is another node (a reference) -->
        <HierarchicalDataTemplate x:Key="ResourceNameValuePairTemplate" ItemsSource="{Binding Value}">

            <TextBlock>
                               
                <TextBlock.Text>
                            
                    <MultiBinding StringFormat="{}Subject [{0}] Predicate [{1}]">
                        <Binding Path="Value.Subject"/>
                        <Binding Path="Name"/>
                    </MultiBinding>
                            
                </TextBlock.Text>
                
            </TextBlock>

        </HierarchicalDataTemplate>
        
        <!-- A dynamic property whose value is a literal value -->
        <HierarchicalDataTemplate x:Key="LiteralNameValuePairTemplate">

            <HierarchicalDataTemplate.Resources>
                
                <local:LiteralToolTipConverter x:Key="LiteralToolTipConverter"/>
                
            </HierarchicalDataTemplate.Resources>
            
            <TextBlock>
                
                <TextBlock.ToolTip>
                    
                    <MultiBinding Converter="{StaticResource LiteralToolTipConverter}">
                                                
                        <Binding Path="PropertyInfo.LiteralTypeString"/>
                        <Binding Path="PropertyInfo.LanguageTag"/>
                        
                    </MultiBinding>
                    
                </TextBlock.ToolTip>
                
                <TextBlock.Text>
                    <MultiBinding StringFormat="{}{0} : {1}">
                        <Binding Path="Name" />
                        <Binding Path="Value" />
                    </MultiBinding>
                </TextBlock.Text>
                
            </TextBlock>

        </HierarchicalDataTemplate>        

        <HierarchicalDataTemplate x:Key="NodeListTemplate" ItemsSource="{Binding}">            
        </HierarchicalDataTemplate>
        
        <HierarchicalDataTemplate x:Key="NodeTemplate" ItemsSource="{Binding Model}">
               
            <!-- Node implements NameValuePair IEnumerable which displays the properties associated with the node -->
            <TextBlock Text="{Binding Model.Subject}"/>
               
        </HierarchicalDataTemplate>
        
        <HierarchicalDataTemplate x:Key="LiteralNodeTemplate">
            <TextBlock Text="{Binding}"/>
        </HierarchicalDataTemplate>
        
        <DataTemplate x:Key="NodeContentTemplate">
            
            <Grid>
                
                <Grid.RowDefinitions>
                    
                    <RowDefinition Height="Auto"/>
                    
                </Grid.RowDefinitions>

                <TextBlock Text="{Binding Path=Subject, StringFormat={}Subject: {0}}"/>
                
            </Grid>
            
        </DataTemplate>

    </Application.Resources>
</Application>
